home *** CD-ROM | disk | FTP | other *** search
/ isnet Internet / Isnet Internet CD.iso / prog / hiz / 09 / 09.exe / adynware.exe / perl / lib / adynware / execute.pm < prev    next >
Encoding:
Perl POD Document  |  1999-12-28  |  673 b   |  30 lines

  1. package execute;
  2. use strict;
  3. use IO::File;
  4. use utility_file;
  5.  
  6. sub go
  7. {
  8.         my($program, $input) = @_;
  9.         my $inputFileName = "tmp.input";
  10.         my $outputFileName = "tmp.output";
  11.         
  12.         my $inputFile = new IO::File("> $inputFileName") or die "could not open $inputFileName: $!";
  13.         binmode $inputFile;
  14.         print $inputFile $input;
  15.         $inputFile->close();
  16.         
  17.         my $command = "$program < $inputFileName > $outputFileName";
  18.         system($command);
  19.         
  20.         my $outputData = utility_file::getContent($outputFileName);
  21.         unlink($inputFileName);
  22.         unlink($outputFileName);
  23.         return $outputData;
  24. }
  25. 1;
  26.  
  27.  
  28.  
  29.  
  30.